<template>
  <div>
    <div class="title">
      <el-row>
        <el-col :span="1" style="width: 50px;">
          <span style="color:#757575;">位置 : </span>
        </el-col>
        <el-col :span="20">
          <span @click="tableshow" class="hand" :class="{'textactive' : !secondshow}">简历审核</span>
          <span v-if="secondshow" :class="{'textactive' : secondshow}"> > {{secondtitle}}</span>
        </el-col>
      </el-row>
    </div>
    <div class="posttable" v-show="!addShow">
      <el-row type="flex" justify="center" style="padding-top: 50px;">
        <el-col :span="23">
          <el-table
            ref="singleTable"
            highlight-current-row
            :data="tableData"
            @current-change="handleCurrentChange"
          >
            <el-table-column
              label="推送客户"
              width="120">
              <template slot-scope="scope">
                <!-- prop="name" -->
                <span style="color: #757575;">{{scope.row.customerName}}</span>
              </template>
            </el-table-column>
            <el-table-column
              label="需求编号"
              width="140">
              <template slot-scope="scope">
                <!-- prop="name" -->
                <span>{{scope.row.requireNum}}</span>
              </template>
            </el-table-column>
            <el-table-column
              prop="postName"
              label="推送职位"
            >
            </el-table-column>
            <el-table-column prop="postLevel" label="职位级别"></el-table-column>
            <el-table-column prop="area" label="所属区域"></el-table-column>
            <el-table-column label="姓名">
              <template slot-scope="scope">
                <!-- prop="name" -->
                <span style="cursor: pointer; color:#1198ff;" @click="seedetails(scope.row)">{{scope.row.name}}</span>              
                </template>
            </el-table-column>
            <el-table-column label="毕业时间">
              <template slot-scope="scope">
                <span>{{scope.row.graduationTime | converTime("YYYY-MM")}}</span>
              </template>
            </el-table-column>
            <el-table-column label="出生年月">
              <template slot-scope="scope">
                <span>{{scope.row.birthday | converTime("YYYY-MM")}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="phone" label="联系方式"></el-table-column>
            <el-table-column prop="status" label="离职状态"></el-table-column>
            <el-table-column prop="" label="期望薪资">
              <template slot-scope="scope">
                <span v-if="scope.row.customerName !== '港交所'">{{scope.row.expectSalary}}k*{{scope.row.expectSalaryNum}}</span>
                <span v-if="scope.row.customerName == '港交所'">无</span>
              </template>
            </el-table-column>
            <el-table-column label="到岗时间">
              <template slot-scope="scope">
                <span>{{scope.row.entryTime}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="pusherName" label="推送人"></el-table-column>
            <el-table-column label="推送时间">
              <template slot-scope="scope">
                <span>{{scope.row.createTime | converTime("YYYY-MM-DD")}}</span>
              </template>
            </el-table-column>
            <el-table-column prop="initialEvaluation" label="初步评价" show-overflow-tooltip></el-table-column>
            <el-table-column label="简历名称">
              <template slot-scope="scope">
                <!-- prop="originalFilename" -->
                <span>{{scope.row.originalFilename}}</span>
              </template>
            </el-table-column>
          </el-table>
          <div class="pager">
            <el-pagination
              @size-change="handleSizeChange"
              @current-change="pagehandleCurrentChange"
              :current-page="currentPage"
              :page-sizes="[5,10,15]"
              :page-size="pagesize"
              layout="total, sizes, prev, pager, next, jumper"
              :total="totalcount"
            ></el-pagination>
          </div>
        </el-col>
      </el-row>
    </div>
  
    <div v-if="type == 1">
      <resume-detail :detail-code="detailcode" v-show="addShow" @getapprovalList="getApprovalList1"></resume-detail>
    </div>
   
    
  </div>
</template>

<script>
  import axios from 'axios'
  import ResumeDetail from './resumedetail'
  
  export default {
    name: "resumereview",
    data() {
      return {
        tableData: [],
        currentPage: 1,
        pagesize: 15,
        totalcount: null,
        detailcode: null,
        type : null,
        addShow: false,
        secondshow: false
      }
    },
    created() {
      this.getApprovalList();
    },
    methods: {
      getApprovalList() {
        axios.post(this.url + '/resumeUpload/getApprovalList',{
          pageNum : this.currentPage,
          pageSize : this.pagesize
        }).then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.addShow = false;
            this.secondshow = false;
            this.type = null;
            this.tableData = res.data.data.list;
            this.totalcount = res.data.data.total;
          }
        })
      },
      getApprovalList1() {
        this.currentPage = 1;
        axios.post(this.url + '/resumeUpload/getApprovalList',{
          pageNum : this.currentPage,
          pageSize : this.pagesize
        }).then(res => {
          this.unlogin(res.data.code);
          if (res.data.code == 200) {
            this.addShow = false;
            this.secondshow = false;
            this.type = null;
            this.tableData = res.data.data.list;
            this.totalcount = res.data.data.total;
          }
        })
      },
      //新增按钮按下鼠标变化背景色
      adddown() {
        this.newcolor = true
      },
      //松开按钮变化背景色
      addup() {
        this.newcolor = false
      },
      seedetails(val) {
        this.detailcode = val;
        this.addShow = true;
        this.secondshow = true;
        this.secondtitle = "查看简历详情";
        this.type = 1;
      },
      //点击表格行，获取当前行的数据
      handleCurrentChange(val) {
        this.currentRow = val;
      },
      //改变表格的页面展示数量
      handleSizeChange(val) {
        this.pagesize = val;
        this.getApprovalList();
      },
      //修改当前表格页数
      pagehandleCurrentChange(val) {
        this.currentPage = val;
        this.getApprovalList();
      },
      tableshow(row){
        this.addShow = false;
        this.secondshow = false;
        this.$refs.singleTable.setCurrentRow(row);
        this.type = null;
      }
    },
    components: {
      ResumeDetail
    }
  }
</script>

<style scoped>
  .title {
    background-color: #fff;
    height: 40px;
    line-height: 40px;
    font-size: 14px;
    padding-left: 20px;
    margin-top: 6px;
    margin-bottom: 6px;
  }
  
  .posttable {
    min-height: 700px;
    background-color: #fff;
  }
  
  .tabletitle {
    margin-left: 20px;
    height: 50px;
    line-height: 50px;
  }
  
  
  .textactive {
    color: #1099ff;
  }
  
  
  .pager {
    width: 100%;
    overflow: hidden;
    position: relative;
    margin-top: 10px;
    margin-bottom: 10px;
  }
  
  .el-pagination {
    margin-left: 50%;
    transform: translateX(-50%);
  }
</style>
